<?
$sub_menu = "400900";
include_once("./_common.php");
include_once("$g4[path]/lib/cheditor4.lib.php");

auth_check($auth[$sub_menu], "w");
$g4[title] = "상점설정";

$sql = "select * from g4_shop where idx='1' limit 1";
$shop = mysql_fetch_array(mysql_query($sql));

include_once("./admin.head.php");

$colspan="2";
?>
<script src="<?=$g4[cheditor4_path]?>/cheditor.js"></script>
<?=cheditor1('tranc_info', '100%', '150');?>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<form name="shop_frm" method="post" action="shop_update.php">
<input type="hidden" name="shop_idx" value="<?=$shop[idx]?>">
	<colgroup>
		<col width="120">
		<col width="">
	</colgroup>
	<tr><td colspan="<?=$colspan?>" height="1" bgcolor="#D7D7D7"></td></tr>
	<tr>
		<td class="bgcol1 bold">유료배송 조건</td>
		<td><input type="text" class="ed" style="width:80px;text-align:right" name="tranc_if" value="<?=$shop[tranc_if]?>">원 미만 구매시</td>
	</tr>
	<tr><td colspan="<?=$colspan?>" height="1" bgcolor="#D7D7D7"></td></tr>
	<tr>
		<td class="bgcol1 bold">배송비</td>
		<td><input type="text" class="ed" style="width:80px;text-align:right" name="tranc_price" value="<?=$shop[tranc_price]?>">원</td>
	</tr>
	<tr><td colspan="<?=$colspan?>" height="1" bgcolor="#D7D7D7"></td></tr>
	<tr>
		<td class="bgcol1 bold">배송정보</td>
		<td><div style="width:700px"><?=cheditor2('tranc_info', stripslashes($shop[tranc_info]));?></div></td>
	</tr>
	<tr><td colspan="<?=$colspan?>" height="1" bgcolor="#D7D7D7"></td></tr>
	<tr>
		<td class="bgcol1 bold">포인트사용</td>
		<td>
		<input type="radio" name="point_use" value="Y" <?if($shop[point_use]=="Y"){echo("checked");}?>>사용
		<input type="radio" name="point_use" value="N" <?if($shop[point_use]=="N"){echo("checked");}?>>사용안함
		</td>
	</tr>
	<tr><td colspan="<?=$colspan?>" height="1" bgcolor="#D7D7D7"></td></tr>
	<tr>
		<td class="bgcol1 bold">사용가능액</td>
		<td><input type="text" class="ed" style="width:80px;text-align:right" name="point_price" value="<?=$shop[point_price]?>">원부터 사용가능</td>
	</tr>
	<tr><td colspan="<?=$colspan?>" height="1" bgcolor="#D7D7D7"></td></tr>
	<tr>
		<td class="bgcol1 bold">상품당적립금</td>
		<td><input type="text" class="ed" style="width:40px;text-align:right" name="point_per" value="<?=$shop[point_per]?>">%</td>
	</tr>
	<tr><td colspan="<?=$colspan?>" height="1" bgcolor="#D7D7D7"></td></tr>
	<tr>
		<td class="bgcol1 bold">무통장사용<input type="checkbox" name="bank_use" value="Y" <?if($shop[bank_use]=="Y"){echo("checked");}?>></td>
		<td><textarea name="bank_info" class="tx" style="width:300px;height:60px"><?=str_replace("/","\n",$shop[bank_info])?></textarea>(빈칸없이 '|' 로 구분하여 <span style="color:blue">은행명|계좌번호|예금주</span> 형식으로 입력하세요.)</td>
	</tr>
	<tr><td colspan="<?=$colspan?>" height="1" bgcolor="#D7D7D7"></td></tr>
	<tr>
		<td class="bgcol1 bold">데이콤결제</td>
		<td>
		상점ID : <input type="text" class="ed" style="width:100px" name="shop_mid" value="<?=$shop[shop_mid]?>"><br>
		Mert Key : <input type="text" class="ed" style="width:300px" name="shop_mertkey" value="<?=$shop[shop_mertkey]?>"><br>
		<input type="checkbox" name="shop_mode" value="TEST" <?if($shop[shop_mode]=="TEST"){echo("checked");}?>>테스트모드<br>
		<input type="checkbox" name="card_use" value="Y" <?if($shop[card_use]=="Y"){echo("checked");}?>>신용카드
		<input type="checkbox" name="iche_use" value="Y" <?if($shop[iche_use]=="Y"){echo("checked");}?>>자동이체
		<input type="checkbox" name="hp_use" value="Y" <?if($shop[hp_use]=="Y"){echo("checked");}?>>휴대폰결제
		<input type="checkbox" name="ebank_use" value="Y" <?if($shop[ebank_use]=="Y"){echo("checked");}?>>가상계좌
		</td>
	</tr>
	<tr><td colspan="<?=$colspan?>" height="1" bgcolor="#D7D7D7"></td></tr>
	<tr>
		<td colspan="<?=$colspan?>" height="40" align="center">
		<button class="btn1" style="width:60px" onclick="CheckFrm();">등록</button>&nbsp;
		<button class="btn1" style="width:60px" onclick="history.back(-1);">취소</button>
		</td>
	</tr>
</form>
</table>
<script>
function CheckFrm()
{
	var frm = document.shop_frm;

	if(frm.tranc_if.value == "")
	{
		alert("유료배송 조건을 입력하세요.");
		frm.tranc_if.focus();
	}
	else if(frm.tranc_price.value == "")
	{
		alert("배송비를 입력하세요.");
		frm.tranc_price.focus();
	}
	else if(frm.point_use[0].checked == true && frm.point_price.value == "")
	{
		alert("사용가능액을 입력하세요.");
		frm.point_price.focus();
	}
	else if(frm.point_use[0].checked == true && frm.point_per.value == "")
	{
		alert("상품당적립금을 입력하세요.");
		frm.point_per.focus();
	}
	else
	{
		if(confirm("수정 하시겠습니까?"))
		{
			<?=cheditor3('tranc_info')?>
			frm.submit();
		}
		else
		{
			return false;
		}
	}
}
</script>
<?
include_once ("./admin.tail.php");
?>